<?php
App::import('Vendor','tcpdf/tcpdf');
$tcpdf = new TCPDF();
$textfont = 'helvetica';
 
$tcpdf->SetAuthor("Julia Holland");
$tcpdf->SetAutoPageBreak(true);
 
$tcpdf->setPrintHeader(false);
$tcpdf->setPrintFooter(false);
 
$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($textfont,'',9);
 
$tcpdf->AddPage();
 
// create some HTML content

$htmlcontent = <<<EOD
	<html>
		<body>
			<table border="2">
				<tr>
					<td>test
					</td>
				</tr>
EOD;

foreach ($schools as $school) {
$htmlcontent .= <<<EOD
	<tr>
		<td>
			<table border="1" style="width: 100%">
				<tr>
					<td colspan="3">
						{$school['School']['schoolName']}
					</td>
					<td>
						<b>Contact</b> {$school['Contact']['contactName']}
					</td>
					<td>
						<b>Sponsor by</b> {$school['Sponsor']['sponsorName']}
					</td>
				</tr>
				<tr>
					<td>
						<b>Username</b>
					</td>
					<td colspan="2">
						{$school['User']['userName']}
					</td>
					<td>
						{$school['Contact']['phone']}
					</td>
					<td>
					</td>
				</tr>
				<tr>
					<td>
						<b>User Status</b>
					</td>
					<td colspan="2">
						{$school['User']['active']}
					</td>
					<td>
						{$school['Contact']['email']}
					</td>
					<td>
					</td>
				</tr>
				<tr>
					<td>
						<b>Default SMSC</b>
					</td>
					<td colspan="2">
						
					</td>
					<td>
						Web site
					</td>
					<td>
					</td>
				</tr>
				<tr>
					<td>
						<b>Notes</b>
					</td>
					<td colspan="3">
					</td>
					<td>
						<table border="1" style="width:100%">
							<tr>
								<td>
									School ID
								</td>
								<td align="right">
									{$school['School']['id']}
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
EOD;
}

$htmlcontent .= <<<EOD
			</table>
		</body>
	</html>
EOD;
 
// output the HTML content
$tcpdf->writeHTML($htmlcontent, true, 0, true, 0);
$tcpdf->Output('filename.pdf', 'D');
?>
